package parser;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

public class VocabularyWriter
{
	private static final VocabularyWriter instance =  new VocabularyWriter();
	
	private VocabularyWriter()
	{
		
	}
	
	public static VocabularyWriter getInstance()
	{
		return instance;
	}
	
	public void write(OutputStream outputStream, Iterable<String> words) throws IOException
	{
		OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
		BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
		
		for (String word : words)
		{
			bufferedWriter.write(word);
			bufferedWriter.newLine();
		}
		bufferedWriter.flush();
	}
}
